import request, { download } from '@/utils/request'

// -------------------------------------------------------------------------------------基值管理接口文档----------------------------------------------------------------------------

// 获取基值管理列表---------------------------------------- 
export function list (params) {
  return request({
    url: '/function/consumable/base/list',
    method: 'get',
    params
  })
}

// 获取备件耗材基值模板
export function importConsumableBaseTemplate (data, filename) {
  return download(
    '/function/consumable/base/importConsumableBaseTemplate',
    data,
    filename
  )
}

// 备件耗材基值导入模板
export function importConsumableBaseExcel (data) {
  return request({
    // headers: {
    //   //文件上传的类型
    //   'Content-Type': 'multipart/form-data',
    // },
    url: '/function/consumable/base/importConsumableBaseExcel',
    method: 'post',
    data
  })
}

// 修改：修改基质管理状态接口，启用---禁用---------------------------------------
export function status (data) {
  return request({
    url: '/function/consumable/base/changeStatus',
    method: 'put',
    data
  })
}

// 获取基值管理列表详情---------------------------------------- 
export function listDetail (id) {
  return request({
    url: '/function/consumable/base/' + id,
    method: 'get',
  })
}
// 校验物料基值名称唯一性---------------------------------------- 
export function checkUniqeByName (params) {
  return request({
    url: 'function/consumable/base/checkUniqeByName',
    method: 'get',
    params
  })
}

//新增： 获取字典单位列表---------------------------------------- 
export function listDictionary (params) {
  return request({
    url: '/system/dict/data/list',
    method: 'get',
    params
  })
}

//新增： 获取供应商列表---------------------------------------- 
export function listSupplier (params) {
  return request({
    url: '/function/supplier/list',
    method: 'get',
    params
  })
}

//新增： 获取适用设备列表---------------------------------------- 
export function listApplicable (params) {
  return request({
    url: '/function/equipment/account/partInfo/list',
    method: 'get',
    params
  })
}

//新增： 提交接口---------------------------------------- 
export function add (data) {
  return request({
    url: '/function/consumable/base',
    method: 'post',
    data
  })
}
// 修改：修改基质列表接口---------------------------------------
export function update (data) {
  return request({
    url: '/function/consumable/base',
    method: 'put',
    data
  })
}
// -------------------------------------------------------------------------------------分类管理接口文档----------------------------------------------------------------------------

// 获取分类管理列表---------------------------------------- 
export function listSort (params) {
  return request({
    url: '/function/consumable/type/list',
    method: 'get',
    params
  })
}

// 修改分类管理状态接口---------------------------------------
export function statusSort (data) {
  return request({
    url: '/function/consumable/type/changeStatus',
    method: 'put',
    data
  })
}

// 新增分类管理接口---------------------------------------
export function addSort (data) {
  return request({
    url: '/function/consumable/type',
    method: 'post',
    data
  })
}

// 查询分类管理详情列表---------------------------------------- 
export function listDetailSort (id) {
  return request({
    url: '/function/consumable/type/' + id,
    method: 'get',
  })
}

// 修改分类管理详情接口---------------------------------------
export function updateSort (data) {
  return request({
    url: '/function/consumable/type',
    method: 'put',
    data
  })
}